const initialStore = {
  fields: {},
};

const userInputFields = (state = initialStore, action) => {
  switch (action.type) {
    case 'UPDATE_INPUT':
      return {
        ...state,
        fields: {
          ...action.data,
        },
      };
    case 'CLEAR_ALL_FIELDS':
      return {
        fields: {},
      };
    default:
      return state;
  }
};

export default userInputFields;
